package com.mattidroid.spiegel;

import java.util.Locale;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ShowAboutPage extends Activity {
	
	// read locale settings from prefs and set accordingly
	void setLocale () {
		
		//Dynamic Override system settings LOCALE 
		//Need in all Classes
		GlobalClass GlobalData = ((GlobalClass)getApplicationContext());
	    String languageToLoad  = GlobalData.isLocaleString(GlobalData.overrideLocale);
	    GlobalClass.log(false, "ShowAboutPage.setLocale Locale Setting to : " + languageToLoad);
	    
	    if (languageToLoad.equals("")) {
	    	// do nothing
	    	 GlobalClass.log(false, "applicationInit.setLocale Locale EMPTY");
	    }
	    else {
	    	//Override system settings LOCALE
		    Locale locale = new Locale(languageToLoad); 
		    Locale.setDefault(locale);
		    Configuration config = new Configuration();
		    config.locale = locale;
		    getBaseContext().getResources().updateConfiguration(config, 
		    getBaseContext().getResources().getDisplayMetrics());
	    }
	    
	}
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
	    // read locale settings from prefs and set accordingly
	    setLocale();       
        setContentView(R.layout.full_about);
								
		// Buttons from XML View
		final Button ButtonOkPressed = (Button) findViewById(R.id.ButtonOk);
		ButtonOkPressed.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				// Perform action on clicks
		    	ShowAboutPage.this.finish();
			}
		});

    }
}